package day14;

import java.util.ArrayList;
import java.util.LinkedList;

public class ListTimeTest {
        public static void main(String[] args) {
            LinkedList<Integer> linkedList = new LinkedList<>();
            ArrayList<Integer> arrayList = new ArrayList<>();
            // Adding 100,000 elements to LinkedList
            long startTime = System.nanoTime();
            for (int i = 0; i < 1000; i++) {
                linkedList.add(i);
            }
            long endTime = System.nanoTime();
            long linkedListTime = endTime - startTime;
            System.out.println("Time taken to add 100,000 elements to LinkedList: " + linkedListTime + " ms");
            // Adding 100,000 elements to ArrayList
            startTime = System.nanoTime();
            for (int i = 0; i < 1000; i++) {
                arrayList.add(i);
            }
            endTime = System.nanoTime();
            long arrayListTime = endTime - startTime;
            System.out.println("Time taken to add 100,000 elements to ArrayList: " + arrayListTime + " ms");
        }
    }


